package com.example.demo.dao;

import com.example.demo.model.VideoCardDO;
import com.example.demo.model.VideoDO;
import org.springframework.stereotype.Repository;

import java.util.ArrayList;
import java.util.List;

/**
 * 数据库操作
 */
@Repository
public class VideoCardDao {

    /**
     * 获取数据库中视频卡片信息数据
     * @return 返回视频卡片信息列表
     */
    public List<VideoCardDO> getVideoCards(){
        //先伪造，后期改为数据库
        List<VideoCardDO> vcDOList = new ArrayList<>();
        //视频信息
        VideoDO videoDO0 = new VideoDO(1,"Java","https://xdclass.net",100);
        VideoDO videoDO1 = new VideoDO(2,"C++","https://xdclass.net",90);
        VideoDO videoDO2 = new VideoDO(3,"C#","https://xdclass.net",90);
        List<VideoDO> vDList = new ArrayList<>();
        vDList.add(videoDO0);
        vDList.add(videoDO1);
        vDList.add(videoDO2);
        VideoCardDO vcd0 = new VideoCardDO();
        vcd0.setDesc("开发服务端常用得语言");
        vcd0.setId(1);
        vcd0.setTitle("后端开发");
        vcd0.setVideosList(vDList);
        vcDOList.add(vcd0);

        VideoDO videoDO3 = new VideoDO(1,"语文","https://xdclass.net",110);
        VideoDO videoDO4 = new VideoDO(2,"数学","https://xdclass.net",110);
        VideoDO videoDO5 = new VideoDO(3,"英语","https://xdclass.net",50);
        List<VideoDO> vDList1 = new ArrayList<>();
        vDList1.add(videoDO3);
        vDList1.add(videoDO4);
        vDList1.add(videoDO5);
        VideoCardDO vcd1 = new VideoCardDO();
        vcd1.setDesc("高中知识");
        vcd1.setId(2);
        vcd1.setTitle("语数英");
        vcd1.setVideosList(vDList1);
        vcDOList.add(vcd1);
        return vcDOList;
    }
}
